<?php
/*
	[Office 515158] (C) 2009-2012 天生创想 Inc.
	$Id: oa 1209087 2012-01-08 08:58:28Z baiwei.jiang $
*/

(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');

//if ( !is_superadmin() && !check_purview('manage_link') ) prompt('对不起，你没有权限执行本操作！');

empty($do) && $do = 'list';
if ($do == 'list') {
	include_once('template/departmentoa_checkbox_member.php');

}
//读取部门
function get_department_cok($fatherid=0,$selid=0,$layer=0 ,$style=10)
{


	$str='';
    global $db;
	$query = $db->query("SELECT * FROM ".DB_TABLEPRE."department where father='$fatherid' and unionid='".union_id."'  ORDER BY id Asc  ");
	
	if(count($query)>0){
	   for($i=0;$i<$layer;$i++){
	   
	   $str.='style="padding-left:'.$style.'px;"';
	   
	  }
	
	while ($row = $db->fetch_array($query)) {
	//$selstr = $row['id'] == $selid ? 'selected="selected"' : '';
	
	//$htmlstr= '<option value="'.$row['id'].'"  '.$selstr.'>'.$str.$row['name'].'</option>';
	$htmlstr='<tr><td height="25" '.$str.'><input type="checkbox" name="vid[]" value="'.$row['id'].'" style="border:0px;" onClick="check_all_oamember(this,'.$row['id'].')"/><input type="hidden" name="oaid'.$row['id'].'" value="'.$row['id'].'" style="border:0px;" /><input type="hidden" name="oaname'.$row['id'].'" value="'.$row['name'].'" style="border:0px;" />'.$row['name'].'</td></tr>';
	
	echo $htmlstr."";

	get_department_cok($row['id'],$selid,$layer+1,$style+20);
	
	}

	}
	
   return ;

}
?>
